home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6456 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: ix.netcom.com!netnews
  2. From: judgemi@ix.netcom.com(Michael Judge )
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Change window application from one to another
  5. Date: 8 Feb 1996 15:15:00 GMT
  6. Organization: Netcom
  7. Message-ID: <4fd41k$aks@ixnews4.ix.netcom.com>
  8. References: <4facrt$s1g@unix.sbu.ac.uk>
  9. NNTP-Posting-Host: ix-bst-ma1-01.ix.netcom.com
  10. X-NETCOM-Date: Thu Feb 08  7:15:00 AM PST 1996
  11.  
  12. In <4facrt$s1g@unix.sbu.ac.uk> suogui zhang <suorguz@vax.sbu.ac.uk>
  13. writes: 
  14. >
  15. >hi friend:
  16. >I have some problem with window change from one application to
  17. another. Sometime the display
  18. >is not on the screen. Anybody can tell me how to get current window
  19. and how to change it to
  20. >another.
  21. >
  22. >thanks
  23. >
  24. >S.Zhang
  25. >
  26.  
  27. you can use FindWindow and then SendMessage()
  28.  
  29.   t_Wnd = CWnd::FindWindow("Other App Window",NULL))
  30.   if (t_Wnd)
  31.   {
  32.     // if so, does it have any popups?
  33.     CWnd *ChildCWnd=t_Wnd->GetLastActivePopup();
  34.  
  35.     // Bring the main window to the top.
  36.     t_Wnd->BringWindowToTop();
  37.  
  38.     // If iconic, restore the main window.
  39.     if (t_Wnd->IsIconic())
  40.        t_Wnd->ShowWindow(SW_RESTORE);
  41.  
  42.     // If there was an active popup, bring it along too!
  43.     if (t_Wnd != ChildCWnd)
  44.        ChildCWnd->BringWindowToTop();
  45.    }
  46. This is for Visual C++.  Straight API calls aren't far off from this.
  47.  
  48. MJ
  49.